<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>银行卡</title>

<meta name="viewport" id="mobileViewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<meta http-equiv="Expires" content="-1">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Pragma" content="no-cache">
<meta name="description" content="！">
<meta name="Keywords" content="">

<link rel="stylesheet" href="${contextPath}/staticwx/hx/css/reset.css">
<link rel="stylesheet" href="${contextPath}/staticwx/hx/css/global.css">
<link rel="stylesheet" href="${contextPath}/staticwx/hx/css/iconfont.css">
<link rel="stylesheet" href="${contextPath}/staticwx/hx/css/flex.css">
<link rel="stylesheet" href="${contextPath}/staticwx/hx/css/uc.css">
<link rel="stylesheet" href="//cdn.bootcss.com/weui/1.1.1/style/weui.min.css">
<link rel="stylesheet" href="//cdn.bootcss.com/jquery-weui/1.0.1/css/jquery-weui.min.css">

</head>
<body>
	<div class="wrapper">
	    <header class="header">
	        <div class="hl"><a href="javascript:history.back();"><span class="iconfont icon-fanhui"></span></a></div>
	        <div class="hc">银行卡</div>
	        <div class="hr"><span class="iconfont icon-zhuye"></span></div>
	    </header>
	    <div class="space"></div>
		<div class="titPub">
	        <a href="${contextPath}/wx/bankcard/add.htm?from=0" class="clearfix">
	            <p class="fl">我的银行卡</p>
	            <span class="fr"><span class="cblue f12">+添加银行卡</span></span>
	        </a>
	    </div>
	    <ul class="txList2">
            <#if bclist??>
                <#list bclist as l>
                    <li flex="cross:center">
                        <img class="bcmodify" bankid="${l.id!}" src="${contextPath}/staticwx/hx/images/${l.bankname!}.png" alt="">
                        <div class="con bcmodify" bankid="${l.id!}" realname="${l.realname!}" bankplace="${l.bankplace!}">
                            <p class="p1">${l.bankname!}</p>
                            <p class="p2">${l.bankaccount!}</p>
                        </div>
                        <div class="radioBtn radioBtnCss">
                            <span class="iconfont gou"></span>
                            <input type="radio" name="tixianf" class="">
                        </div>
                    </li>
                </#list>
            </#if>
	    </ul>
	    <div class="btnPub2">
			<a href="javascript:;" class="btn" onclick="del()">删除</a>
	    </div>
	</div>

<script src="${contextPath}/staticwx/hx/js/jquery-3.0.0.min.js" type="text/javascript"></script>
<script src="//cdn.bootcss.com/jquery-weui/1.0.1/js/jquery-weui.min.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $(".bcmodify").click(function(){
            var id = $(this).attr("bankid");
            location.href="${contextPath}/wx/bankcard/modify.htm?bcId="+id;
        });
    })
	$(".txList2 .radioBtn").click(function(){
		$(".txList2 .radioBtn.selected").removeClass("selected");
		$(this).addClass("selected");
		$(".txList2 input[name='tixianf']:checked").prop("checked",false)
		$(this).find("input[name='tixianf']").prop("checked",true)
	});
	function del(){
        var check = $(".txList2 input[name='tixianf']:checked");
        if(check.length==0){
            $.alert("请选择要删除的银行卡");
            return false;
        }
        var mdiv = $(check).parent(".radioBtn").prev(".con");
        var bankid = $(mdiv).attr("bankid");
        $.confirm("确定要删除吗？", function() {
            $.ajax({
                url:"${contextPath}/wx/bankcard/del.htm",
                data:{bcId:bankid},
                type:"post",
                success:function(data){
                    var json = $.parseJSON(data);
                    $.alert(json.errMessage,function(){
                        location.reload();
                    });
                }
            });
        }, function() {
            //点击取消后的回调函数
        });
    }
</script>
</body>
</html>